/**
 * Created by python on 19-3-5.
 */
let vm = new Vue({
    el: '#app',
    data: {
        host: HOST,

        user_id: localStorage.user_id || sessionStorage.user_id,
        token: localStorage.token || sessionStorage.token,

        history_title: 'VirtualBox + Vagrant（统一开发环境）',

        histories: null
    },
    mounted: function(){
        // if (this.user_id) {
        //     axios.post(this.host+'/browse_histories/', {
        //         history_title: this.history_title,
        //         history_address: window.location.href
        //     }, {
        //         headers: {
        //             'Authorization': 'JWT ' + this.token
        //         }
        //     })
        // }
        this.get_histories();
    },
    methods: {
        get_histories: function(){
            axios.get(this.host + '/browse_histories/', {
                headers: {
                    'Authorization': 'JWT ' + this.token
                },
                responseType: 'json'
            })
            .then(response => {
                this.histories = response.data;
                console.log(this.histories)
            })
        }
    }
});